import { Injectable } from '@angular/core';

@Injectable()
export class Channel {

  constructor() { }

  private obj: any = {};



  public init() {

    let ele = (<HTMLLinkElement>document.querySelector("link[rel=icon]"));

    let host: string = window.location.hostname;
    // let host = 'info.veiwa.cn';

    switch (host) {
      // 电商先生
      case 'shop.630game.com':
        document.title = "电商先生";
        this.obj.logoName = "电商先生";
        ele.href = "http://trendata.oss-cn-hangzhou.aliyuncs.com/marketconditions/icon.png";
        this.obj.brand = "./assets/img/dsxs/icon.png";
        this.obj.logPic = "./assets/img/dsxs/text.png";
        this.obj.channel = 2;

        break;

      // 品谱大数据
      case 'www.hzbigdate.com':
        document.title = "品谱大数据";
        this.obj.logoName = "品谱大数据";
        ele.href = "./assets/img/ppdsj/pingpu.png";
        this.obj.index = "http://www.hzpinpu.com";
        this.obj.brand = "./assets/img/ppdsj/pingpu.png";
        this.obj.channel = 3;
        this.obj.logPic = "./assets/img/ppdsj/pingpu-text.jpg";
        this.obj.qq = "22004526";
        this.obj.phone = "18606515991";

        break;

      // 中防小控
      case 'qzt.sinoac.org':
        document.title = "中防小控";
        this.obj.logoName = "中防小控";
        ele.href = "./assets/img/qzt/qzt_ico.png";
        this.obj.index = "http://www.sinoac.org";
        this.obj.brand = "./assets/img/qzt/qzt_brand.png";
        this.obj.channel = 4;
        this.obj.logPic = "./assets/img/qzt/banner.png";
        break;

      // 淘控
      case 'shuju.315taokong.com':
        document.title = "淘控";
        this.obj.logoName = "淘控";
        ele.href = "./assets/img/tkds/logo.jpg";
        this.obj.index = "http://www.315taokong.com/?bdclick=1";
        this.obj.brand = "./assets/img/tkds/logo.jpg";
        this.obj.channel = 5;
        this.obj.contact = "./assets/img/tk_contact.jpg";
        break;

      // 数据空间
      case 'info.veiwa.cn':
        document.title = "数据空间";
        this.obj.logoName = "数据空间";
        ele.href = "./assets/img/sjkj/logo.png";
        this.obj.index = "http://www.315taokong.com/?bdclick=1";
        this.obj.brand = "./assets/img/sjkj/logo.png";
        this.obj.channel = 6;
        break;

      // qbmf
      case 'qbmf.trenddata.cn':
        document.title = "情报魔方";
        this.obj.logoName = "情报魔方";
        ele.href = "http://trendata.oss-cn-hangzhou.aliyuncs.com/marketconditions/favicon.ico";
        this.obj.index = "http://www.trenddata.cn";
        this.obj.brand = "./assets/img/logo.png";
        this.obj.className="qbmf";
        this.obj.channel = 0;
        break;

      // 电商舆情
      case 'dianshangyuqing.com':
        document.title = "电商舆情";
        this.obj.logoName = "电商舆情";
        ele.href = "./assets/img/dsyq/favicon.ico";
        this.obj.brand = "./assets/img/dsyq/logo.png";
        this.obj.channel = 7;
        this.obj.contact = "./assets/img/dsyq/contact.png";
        break;
      //
      case "yun.iweisu.com":
        document.title = "情报参谋";
        this.obj.logoName = "情报参谋";
        ele.href = "./assets/img/fxsj/favicon.ico";
        this.obj.brand = "./assets/img/fxsj/logo.png";
        this.obj.channel = 8;
        this.obj.contact = "./assets/img/fxsj/contact.jpg";

        // document.querySelector("meta[name=keywords]").content = "";
        // document.querySelector("meta[name=description]").content = "";

        break;
      case "www.powerdigits.cn"://www.powerdigits.cn
        document.title = "PowerDigits 电商通";
        this.obj.logoName = "PowerDigits 电商通";
        ele.href = "./assets/img/dst/favicon.png";
        this.obj.brand = "./assets/img/dst/logo.png";
        this.obj.channel = 9;
        this.obj.className="dst";
        this.obj.contact = "./assets/img/dst/contact.jpg";

        // document.querySelector("meta[name=keywords]").content = "";
        // document.querySelector("meta[name=description]").content = "";

        break;
      default:
        document.title = "情报魔方";
        this.obj.logoName = "情报魔方";
        ele.href = "http://trendata.oss-cn-hangzhou.aliyuncs.com/marketconditions/favicon.ico";
        this.obj.index = "http://www.trenddata.cn";
        this.obj.brand = "http://trendata.oss-cn-hangzhou.aliyuncs.com/marketconditions/logo.png";
        this.obj.className="qbmf";
        this.obj.channel = 0;

        // document.title = "PowerDigit 电商通";
        // this.obj.logoName = "PowerDigit 电商通";
        // ele.href = "./assets/img/dst/favicon.png";
        // this.obj.brand = "./assets/img/dst/logo.png";
        // this.obj.channel = 9;
        // this.obj.className="dst";
        // this.obj.contact = "./assets/img/dst/contact.jpg";
        break;
    }


    return this.obj;
  }

}
